package com.ganyu.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ganyu.domain.dto.AdminUserRoleDto;
import com.ganyu.domain.entity.User;
import com.ganyu.domain.vo.AdminInsertUserVo;
import com.ganyu.domain.vo.AdminPeopleInfoVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 用户表(User)表数据库访问层
 *
 * @author chenxi
 * @since 2022-09-15 09:34:28
 */
@Mapper
public interface UserMapper extends BaseMapper<User> {

    //查询用户名是否相同
    User selectUserName(@Param("userName") String userName);

    //查询昵称是否相同
    User selectNickName(@Param("nickName") String nickName);

    //查询密码是否相同
    String selectPassword(@Param("userName") String userName);
    //查询邮箱是否相同
    String selectEmail(@Param("email") String email);

    //分页查询
    List<AdminPeopleInfoVo> selectUserList(@Param("i") int i,@Param("pageSize") Integer pageSize,@Param("userName") String userName,@Param("phonenumber") String phonenumber,@Param("status") String status);

    int selectUserCount(@Param("userName")String userName,@Param("phonenumber") String phonenumber,@Param("status") String status);

    //插入用户到数据库中
    void insertUser(AdminUserRoleDto adminUserRoleDto);

    User selectByUserName(@Param("userName") String userName);

    User selectByPhone(@Param("phonenumber") String phonenumber);

    User selectByEmail(@Param("email") String email);

    //根据userName获取id
    Long selectIdByUserName(@Param("userName") String userName);

    //根据id删除用户
    void deleteUser(@Param("ids") Long[] ids);

    //根据用户id获取用户信息
    User selectUserById(Long id);

    //修改用户信息
    void updateUser(AdminInsertUserVo adminInsertUserVo);
}

